<template>
	<iframe
		:key="iframeSrc"
		:src="iframeSrc"
		frameborder="0"
		scrolling="no"
		:width="width + 'px'"
		:height="height + 'px'"
	/>
</template>
<script>
import qs from "qs";
export default {
	props: {
		width: {
			type: Number,
			default: 365
		},
		height: {
			type: Number,
			default: 400
		},
		options: {
			type: Object,
			default: () => ({})
		}
	},
	computed: {
		iframeSrc() {
			const { options } = this;
			let query = { goto: options.goto };
			if (options.style) {
				query.style = options.style;
			}
			if (options.href) {
				query.href = options.href;
			}
			return "https://login.dingtalk.com/login/qrcode.htm?" + qs.stringify(query);
		}
	}
};
</script>
